<%@ page import="foo.bar.blog.web.action.administration.UserManagementActionBean" %>
<%@include file="/WEB-INF/pages/commons/commons.jsp"%>

<fmt:message var="title" key="userManagement.jsp.title" scope="request" />
<stripes:layout-render name="${_themePath}/basic-layout-without-navbar.jsp" _title="${title}">

    <stripes:layout-component name="_head">
        <jsecurity:hasPermission name="user:viewUser:*">
        <script type="text/javascript">
            function view(url) {
                $("#space").html("<fmt:message key='global.loading'/>");
                $.get(
                    url,
                    function(data) {
                        $("#space").hide();
                        $("#space").html(data);
                        $("#space").fadeIn();
                    }
                );
            }
            function edit(url) {
                $("#space").html("<fmt:message key='global.loading'/>");
                var xhr = $.get(
                    url,
                    function(data) {
                            $("#space").hide();
                            $("#space").html(data);
                            $("#space").fadeIn();
                    }
                );
            }
            function remove(url) {
                $("#table").html("<fmt:message key='global.processing'/>");
                $.get(url,
                      function(data) {
                          $("#table").hide();
                          $("#table").html(data);
                          $("#table").fadeIn();
                          if (xhr.getResponseHeader('X-AjaxRequestStatus')) {
                                $("#table").html('<fmt:message key="global.loading"/>')
                                $.get(
                                    '<stripes:url beanclass="foo.bar.blog.web.action.administration.UserManagementActionBean" event="userListing"/>',
                                    function(data) {
                                        $("#table").hide();
                                        $("#table").html(data);
                                        $("#table").fadeIn();
                                });
                          }
                          return false;
                      });
            }
            function add(url) {
                $("#space").html("<fmt:message key='global.loading'/>");
                var xhr = $.get(url,
                      function(data) {
                            $("#space").hide();
                            $("#space").html(data);
                            $("#space").fadeIn();
                      });
            }
            $(document).ready(function() {

            });
        </script>
        </jsecurity:hasPermission>
    </stripes:layout-component>


    <stripes:layout-component name="_topNav">
            <H1>User Management</H1>
            <UL class="gc-topnav-tabs">
                <LI>&nbsp;</LI>
            </UL>
    </stripes:layout-component>
    


    <stripes:layout-component name="_content">
        <jsecurity:hasPermission name="user:viewUser:*">
        <div id="space">
        </div>

        <h2>Users</h2>
        <div id="table">
            <%@include file="userManagement_table.jsp"%>
        </div>
        </jsecurity:hasPermission>
        <jsecurity:lacksPermission name="user:viewUser:*">
            No "user:viewUser:*" permission
        </jsecurity:lacksPermission>
    </stripes:layout-component>


</stripes:layout-render>


